package com.oot2d.util;

import org.python.util.PythonInterpreter;

public class EventManager {
    private static PythonInterpreter interp;

    public static void init()
    {
        interp = new PythonInterpreter();
        //interp.execfile("res/scripts/test.py");
    }

    public static enum EventType
    {
        MAP,
        CUTSCENE,
        NPC,
        ENTITY
    }

    //Interpret an event
    public static void handle(EventType t, String event)
    {
        if (t == EventType.MAP)
            runScript("map/" + event);

        else if (t == EventType.CUTSCENE)
            runScript("cutscene/" + event);

        else if (t == EventType.NPC)
            runScript("npc/" + event);

        else if (t == EventType.ENTITY)
            runScript("entity/" + event);
    }

    //Run a Jython script
    private static void runScript(String name)
    {
        interp.execfile(name);
    }
}
